package com.itboye.ihomebank.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itboye.ihomebank.R;
import com.itboye.ihomebank.ttKey.ViewHolder;

import java.util.List;

/**
 * 白马锁蓝牙搜索列表
 */
public class SheBeiTwoAdapter  extends BaseAdapter {
    Context context;
    List<String> list;
    public SheBeiTwoAdapter(Context context,List<String> list) {
        this.context = context;
        this.list = list;
    }
    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = ViewHolder.get(context, convertView, R.layout.item_device_two);
        TextView deviceName  = viewHolder.getView(R.id.device_name);
        TextView macAddress = viewHolder.getView(R.id.device_address);
        TextView addIcon = viewHolder.getView(R.id.device_add_able);
        addIcon.setVisibility(View.VISIBLE);
        deviceName.setText("住家智能锁");
        macAddress.setText(list.get(position));
        return viewHolder.getConvertView();
    }
}
